
package cn.edu.scau.cmi.hombio.web.rest;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Unit test for the <code>CureMedicineRestController</code> controller.
 *
 * @see cn.edu.scau.cmi.hombio.web.rest.CureMedicineRestController
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
		"file:./resources/pigRs-security-context.xml",
		"file:./resources/pigRs-service-context.xml",
		"file:./resources/pigRs-dao-context.xml",
		"file:./resources/pigRs-web-context.xml" })
public class CureMedicineRestControllerTest {
	/**
	 * The Spring application context.
	 *
	 */
	private ApplicationContext context;

	/**
	 * Test <code>CureMedicinecuremedicine_idcureMethod()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idcureMethod() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/cureMethod");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idcureMethod()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostCureMedicinecuremedicine_idcureMethod() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/cureMethod");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idcureMethod()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutCureMedicinecuremedicine_idcureMethod() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/cureMethod");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idcureMethodcuremethod_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteCureMedicinecuremedicine_idcureMethodcuremethod_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/cureMethod/{curemethod_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idcureMethodcuremethod_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idcureMethodcuremethod_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/cureMethod/{curemethod_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idmedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idmedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/medicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idmedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostCureMedicinecuremedicine_idmedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/medicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idmedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutCureMedicinecuremedicine_idmedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/medicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idmedicinemedicine_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteCureMedicinecuremedicine_idmedicinemedicine_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/medicine/{medicine_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idmedicinemedicine_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idmedicinemedicine_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/medicine/{medicine_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostCureMedicinecuremedicine_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idunit()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutCureMedicinecuremedicine_idunit() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/unit");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idunitunit_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteCureMedicinecuremedicine_idunitunit_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/unit/{unit_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_idunitunit_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_idunitunit_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}/unit/{unit_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void GetCureMedicinecuremedicine_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PutCureMedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicine()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void PostCureMedicine() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Test <code>CureMedicinecuremedicine_id()</code>.
	 */
	@Test
	@SuppressWarnings("unused")
	public void DeleteCureMedicinecuremedicine_id() throws Exception {
		MockHttpServletRequest request = getMockHttpServletRequest();
		request.setRequestURI("/CureMedicine/{curemedicine_id}");
		MockHttpServletResponse response = getMockHttpServletResponse();

		// Get the singleton controller instance
		CureMedicineRestController controller = (CureMedicineRestController) context.getBean("CureMedicineRestController");

		// TODO Invoke method and Assert return values

	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Returns a mock HttpServletRequest object.
	 *
	 */
	private MockHttpServletRequest getMockHttpServletRequest() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
		return request;
	}

	/**
	 * Returns a mock HttpServletResponse object.
	 *
	 */
	private MockHttpServletResponse getMockHttpServletResponse() {
		return new MockHttpServletResponse();
	}
}